<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      font-size: 0;
    }

    .box {
      height: 100px;
      background-color: #f00;
      /* margin用于设置元素之间的距离 */
      margin-bottom: 30px;
    }

    .container {
      height: 100px;
      background-color: #0f0;
      /* margin-top: 30px; */
    }

    .box1 {
      display: inline-block;
      height: 100px;
      width: 100px;
      background-color: #f00;
      margin-right: 30px;
    }

    .box2 {
      display: inline-block;
      height: 100px;
      width: 100px;
      background-color: #0f0;
      margin-left: 30px;
    }
  </style>
</head>

<body>
  <div class="box"></div>
  <div class="container"></div>
  <hr>
  <div class="box1"></div>
  <div class="box2"></div>
</body>

</html>